using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Collections;
using System.Collections.Generic;
using System.Web.Script.Serialization;


namespace Ajax.Logging
{
    public class ExceptionInfo
    {
        private int _code;
        private string _type = string.Empty;
        private string _message = string.Empty;
        private string _description = string.Empty;
        private string _stackTrace = string.Empty;
        private int _lineNumber = -1;
        private string _url = string.Empty;
        private string _referrer = string.Empty;
        private List<string> _scripts;

        private bool _isAuthenticated;
        private string _userName = string.Empty;
        private string _ipAddress = string.Empty;
        private string _dns = string.Empty;
        private string _userAgent = string.Empty;
        private DateTime _serverTime = DateTime.MinValue;
        private IDictionary<string, string> _cookies;
        private IDictionary<string, object> _additionalData;

        public int Code
        {
            [DebuggerStepThrough()]
            get
            {
                return _code;
            }
            [DebuggerStepThrough()]
            set
            {
                _code = value;
            }
        }

        public string Type
        {
            [DebuggerStepThrough()]
            get
            {
                return _type;
            }
            [DebuggerStepThrough()]
            set
            {
                _type = value;
            }
        }

        public string Message
        {
            [DebuggerStepThrough()]
            get
            {
                return _message;
            }
            [DebuggerStepThrough()]
            set
            {
                _message = value;
            }
        }

        public string Description
        {
            [DebuggerStepThrough()]
            get
            {
                return _description;
            }
            [DebuggerStepThrough()]
            set
            {
                _description = value;
            }
        }

        public string StackTrace
        {
            [DebuggerStepThrough()]
            get
            {
                return _stackTrace;
            }
            [DebuggerStepThrough()]
            set
            {
                _stackTrace = value;
            }
        }

        public int LineNumber
        {
            [DebuggerStepThrough()]
            get
            {
                return _lineNumber;
            }
            [DebuggerStepThrough()]
            set
            {
                _lineNumber = value;
            }
        }

        [SuppressMessage("Microsoft.Design", "CA1056:UriPropertiesShouldNotBeStrings")]
        public string Url
        {
            [DebuggerStepThrough()]
            get
            {
                return _url;
            }
            [DebuggerStepThrough()]
            set
            {
                _url = value;
            }
        }

        public string Referrer
        {
            [DebuggerStepThrough()]
            get
            {
                return _referrer;
            }
            [DebuggerStepThrough()]
            set
            {
                _referrer = value;
            }
        }

        [SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
        [SuppressMessage("Microsoft.Design", "CA1002:DoNotExposeGenericLists")]
        public List<string> Scripts
        {
            [DebuggerStepThrough()]
            get
            {
                if (_scripts == null)
                {
                    _scripts = new List<string>();
                }

                return _scripts;
            }
            [DebuggerStepThrough()]
            set
            {
                _scripts = value;
            }
        }

        [ScriptIgnore()]
        public bool IsAuthenticated
        {
            [DebuggerStepThrough()]
            get
            {
                return _isAuthenticated;
            }
            [DebuggerStepThrough()]
            set
            {
                _isAuthenticated = value;
            }
        }

        [ScriptIgnore()]
        public string UserName
        {
            [DebuggerStepThrough()]
            get
            {
                return _userName;
            }
            [DebuggerStepThrough()]
            set
            {
                _userName = value;
            }
        }

        [ScriptIgnore()]
        public string IPAddress
        {
            [DebuggerStepThrough()]
            get
            {
                return _ipAddress;
            }
            [DebuggerStepThrough()]
            set
            {
                _ipAddress = value;
            }
        }

        [ScriptIgnore()]
        public string Dns
        {
            [DebuggerStepThrough()]
            get
            {
                return _dns;
            }
            [DebuggerStepThrough()]
            set
            {
                _dns = value;
            }
        }

        [ScriptIgnore()]
        public string UserAgent
        {
            [DebuggerStepThrough()]
            get
            {
                return _userAgent;
            }
            [DebuggerStepThrough()]
            set
            {
                _userAgent = value;
            }
        }

        [ScriptIgnore()]
        public DateTime ServerTime
        {
            [DebuggerStepThrough()]
            get
            {
                return _serverTime;
            }
            [DebuggerStepThrough()]
            set
            {
                _serverTime = value;
            }
        }

        [ScriptIgnore()]
        [SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
        public IDictionary<string, string> Cookies
        {
            [DebuggerStepThrough()]
            get
            {
                if (_cookies == null)
                {
                    _cookies = new Dictionary<string, string>();
                }

                return _cookies;
            }
            [DebuggerStepThrough()]
            set
            {
                _cookies = value;
            }
        }

        [ScriptIgnore()]
        public IDictionary<string, object> AdditionalData
        {
            [DebuggerStepThrough()]
            get
            {
                if (_additionalData == null)
                {
                    _additionalData = new Dictionary<string, object>();
                }

                return _additionalData;
            }
        }
    }
}